package model;
// default package

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Treceipt entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "treceipt", catalog = "test")
public class Treceipt implements java.io.Serializable {

	// Fields

	private String tid;
	private Tvip tvip;
	private Tuser tuser;
	private Timestamp date;
	private String state;
	private Double totalprice;
	private Set<Tshoplist> tshoplists = new HashSet<Tshoplist>(0);
	private Set<Tpayment> tpayments = new HashSet<Tpayment>(0);
	private Set<Tsalereturn> tsalereturns = new HashSet<Tsalereturn>(0);

	// Constructors

	/** default constructor */
	public Treceipt() {
	}

	/** minimal constructor */
	public Treceipt(String tid) {
		this.tid = tid;
	}

	/** full constructor */
	public Treceipt(String tid, Tvip tvip, Tuser tuser, Timestamp date, String state, Double totalprice, Set<Tshoplist> tshoplists, Set<Tpayment> tpayments, Set<Tsalereturn> tsalereturns) {
		this.tid = tid;
		this.tvip = tvip;
		this.tuser = tuser;
		this.date = date;
		this.state = state;
		this.totalprice = totalprice;
		this.tshoplists = tshoplists;
		this.tpayments = tpayments;
		this.tsalereturns = tsalereturns;
	}

	// Property accessors
	@Id
	@Column(name = "tid", unique = true, nullable = false)
	public String getTid() {
		return this.tid;
	}

	public void setTid(String tid) {
		this.tid = tid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "vip")
	public Tvip getTvip() {
		return this.tvip;
	}

	public void setTvip(Tvip tvip) {
		this.tvip = tvip;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cashier")
	public Tuser getTuser() {
		return this.tuser;
	}

	public void setTuser(Tuser tuser) {
		this.tuser = tuser;
	}

	@Column(name = "date", length = 19)
	public Timestamp getDate() {
		return this.date;
	}

	public void setDate(Timestamp date) {
		this.date = date;
	}

	@Column(name = "state")
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "totalprice", precision = 255)
	public Double getTotalprice() {
		return this.totalprice;
	}

	public void setTotalprice(Double totalprice) {
		this.totalprice = totalprice;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "treceipt")
	public Set<Tshoplist> getTshoplists() {
		return this.tshoplists;
	}

	public void setTshoplists(Set<Tshoplist> tshoplists) {
		this.tshoplists = tshoplists;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "treceipt")
	public Set<Tpayment> getTpayments() {
		return this.tpayments;
	}

	public void setTpayments(Set<Tpayment> tpayments) {
		this.tpayments = tpayments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "treceipt")
	public Set<Tsalereturn> getTsalereturns() {
		return this.tsalereturns;
	}

	public void setTsalereturns(Set<Tsalereturn> tsalereturns) {
		this.tsalereturns = tsalereturns;
	}

}